﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZF.BLL;
using GCELibrary.Current;
using ZF.BLL.Page;

namespace ZF.WS.news
{
    public partial class list :PageBase
    {
        [PageArgument(Key = "type",DefaultValue=null)]
        public string Type { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            using (var dc = SiteInfo.CreateDBDataContext())
            {

                string[] types = DictionaryConfig.INewType.Select(p => p.Key).ToArray();
                Dictionary<string, List<Model.I_News>> dicType = new Dictionary<string, List<Model.I_News>>();
                var sel = dc.I_News.Where(p => p.IsV);
                if (this.Type != null)
                {
                    sel = sel.Where(p => p.Type == this.Type);
                }
                var list = sel.OrderByDescending(p => p.NewsId).Take(20).ToList();




                this.lvNews.DataSource = list;
                this.lvNews.DataBind();
            }
        }
    }
}
